import ColorMaterial from './colorMaterial';

class AmbientLight {
    constructor(intensity = 0.2) {
        this._intensity = intensity;
        this._material = new ColorMaterial();

        let color = this._material.color;
        this._finalColor = cc.color(color.r * intensity, color.g * intensity, color.b * intensity, 255);
    }

    get finalColor() {
        return this._finalColor;
    }
}

class DirLight {
    constructor(dir,intensity = 0.8) {
        this._dir = dir; // 光的方向 : 从表面到眼睛
        cc.Vec3.normalize(this._dir,this._dir);
        this._material = new ColorMaterial();
        this._material.setColor(cc.Color.RED);
        this._intensity = intensity;

        let mc = this._material.color;
        this._finalColor = cc.color(mc.r * intensity, mc.g * intensity, mc.b * intensity, 255);
    }

    get finalColor() {
        return this._finalColor;
    }

    get dir(){
        return this._dir;
    }
}

export {
    DirLight,
    AmbientLight
};
